<template>
  <div id="app">
    <!-- <router-view/> -->
    <keep-alive>
    <router-view v-if="$route.meta.keepAlive"></router-view>
    </keep-alive>
    <router-view v-if="!$route.meta.keepAlive"></router-view>
  </div>
</template>

<script>
export default {
  name: 'App',
  created() {
    // var appid1 = "wxb94fe8357c844b53";
    // var code = this.getUrlParam("code");
    // var local = window.location.href;
    // if (code == null || code === ''){
    //   window.location.href = "https://open.weixin.qq.com/connect/oauth2/authorize?appid="
    //     + appid1
    //     + "&redirect_uri="
    //     + encodeURIComponent(local)
    //     + "&response_type=code"
    //     + "&scope=snsapi_base"
    //     + "&state=1"
    //     + "#wechat_redirect";
    //
    // }else {
    //   var url = "http://dlsapi.rz158.com/thirdPay/getOpenId?code=" + code;
    //   axios.post(url).then((response) => {
    //     localStorage.setItem("openid", response.data.t);
    //     alert(response.data.t)
    //   }).catch((error) => {
    //   })
    // }
  },
  methods: {
    getUrlParam (name) {
      var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
      var r = window.location.search.substr(1).match(reg);
      if (r != null) return unescape(r[2]);
      return null;
    }
  }
  
}
</script>
<style>
  @import './assets/css/default.css';
  @import './assets/css/common.less';
</style>
